<!doctype html>
<html>
<head>
<meta charset="utf-8"/>
<title>Issue Test</title>
<script src="../../../dist/sea.js"></script>
</head>

<body>

<div id="out"></div>

<script>

  var pageBase = location.href.replace(/(.*\/)([^\/]+)/, '$1');

  seajs.use('../../test', function(test) {

    // 1. anonymous before anonymous
    define(function() { return { name: 'x' }; });

    seajs.use('./a', function(a) {
      test.assert(a.name === 'a', a.name);

      // 2. anonymous before specific
      define({ name: 'x2' });

      seajs.use('./b', function(b) {
        test.assert(b.name === 'b', b.name);

        // 3. anonymous and specific modules in one file
        seajs.use('./c', function(c) {
          seajs.use('./c2', function(c2) {

            test.assert(c.name === 'c', c.name);
            test.assert(c2.name === 'c2', c2.name);

            test.done();
          });
        });

      });

    });

  });

  // 注意：
  // 当页面中定义了匿名模块，脚本中定义了具名模块，具名模块的 url 不是脚本路径时，会将
  // 页面中的匿名模块存储成当前脚本路径的模块。
  //
  // 上面这种情况很少出现，要处理好却很麻烦，因此就“放任自流”了。


  function printResults(txt, style) {
    var d = document.createElement('div');
    d.innerHTML = txt;
    d.className = style;
    document.getElementById('out').appendChild(d);
  }

</script>
</body>
</html>